<template>
  <div>
    <!-- 轮播图 -->
    <el-carousel :interval="3000" arrow="always" height="372px">
      <el-carousel-item v-for="item in list" :key="item.id">
        <img :src="item.image" />
      </el-carousel-item>
    </el-carousel>
    <!-- 搜索框 -->
    <div class="bgc">
      <div class="demo-input-suffix">
        <p>搜索<i></i></p>
        <el-input
          v-model="title_contains"
          placeholder="请输入想要的房子类型"
        >
          <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
        </el-input>
      </div>
    </div>
  </div>
</template>

<script>
import { categoriesList } from "@/api/agents";
export default {
  data() {
    return {
      list: [],
      title_contains: "",
    };
  },
  async created() {
    const res = await categoriesList();
    console.log(36, res);
    this.list = res.data;
    console.log(this.list);
  },


  methods:{
    search(title_contains){
      // console.log(111);
      this.$router.push({path:'/property',query:{title_contains:this.title_contains}})
    }
  }
};
</script>
<style  scoped>
.el-carousel__item h3 {
  color: #475669;
  font-size: 18px;
  opacity: 0.75;
  line-height: 300px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
.bgc {
  margin: 60px 0;
  height: 200px;
  /* background-color:#d0f5a5; */
  opacity: 0.6;
  position: relative;
  background: url("@/assets/common/347036.jpg") ;
   background-size: 100% 200%;
  /* background: url("@/assets/common/311320.jpg") no-repeat;
  opacity: 0.8;
  background-size: 100% 100%;
  position: relative; */
}
.demo-input-suffix {
  position: absolute;
  top: 20%;
  left: 30%;
}
.el-input {
  width: 600px;
}
::v-deep .el-input__inner {
  border-radius: 0;
  border: none;
  height: 60px;
  background-color: #f7f1da;
  /* border-radius: 5px; */
}
::v-deep .el-input-group__append{
  background-color: #efd240;
}
p {
  background-color: #efd240;
  height: 40px;
  width: 60px;
  text-align: center;
  line-height: 40px;
}
i {
  position: absolute;
  left: 60px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0px 20px 40px 0;
  border-color: red transparent #efd240 transparent;
}
</style>>
